<template>
    <div>
        订单已生成，订单号是：{{ this.$route.query.orderNo }} ,金额：<span>{{ this.$route.query.account }}</span>
        <div>选择支付方式：
            <el-radio v-model="radio" label="1">微微支付</el-radio>
  <el-radio v-model="radio" label="2">支付宝支付</el-radio>
        </div>
        <div>
            <div v-html="body" class="bodyForm"></div>
            <el-button type="danger" @click="eventPay">立即支付</el-button>
        </div>
    </div>
</template>

<script>
  export default {
    data () {
      return {
        radio: '1',
        body:''
      };
    },
    methods:{
        eventPay(){
            let url=this.$baseUrl + '/order/alipay'
            this.$http.get(url,{
                params:{
                    orderNo:this.$route.query.orderNo
                }
            }).then(res=>{
                console.log(res)
                if(res.data.code == 200){
                    this.body = res.data.data
                    this.$nextTick(()=>{
                        document.forms[0].submit()
                    })
                    
                }
            })
        }
    }
  }
</script>

<style scoped>
.bodyForm{
    width:1px;
    height: 1px;
    opacity: 0;
}
</style>